//
//  ByIndexNewVC.m
//  mijifen_ios
//
//  Created by mc on 2017/10/13.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByIndexNewVC.h"

@interface ByIndexNewVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *table;
@end

@implementation ByIndexNewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initTable];
}
- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];
    
    [self setNaviAttributeWithTranslucent:true stateBarLightContent:true];
}
#pragma mark -
- (void)initTable{
    UIView *headerView = [[UIView alloc] init];
    [self.view addSubview:headerView];
    [headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        UIEdgeInsets inset = UIEdgeInsetsMake(0, 0, (SCREEN_HEIGHT - 200), 0);
        make.edges.equalTo(self.view).insets(inset);
//        make.top.equalTo(self.view);
//        make.left.equalTo(self.view);
//        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, 200));
        
    }];
    headerView.backgroundColor = [UIColor purpleColor];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 80, SCREEN_WIDTH - 40, 20)];
    
    titleLabel.text = @"测试测试测试测试";
    [headerView addSubview:titleLabel];
//    titleLabel.textColor = [UIColor whiteColor];
//    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        UIEdgeInsets inset = UIEdgeInsetsMake(20, 50, - 80, -20);
//        make.edges.equalTo(self.view).insets(inset);
//    }];
    
    _table = [[UITableView alloc] init];
    _table.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:_table];
    _table.separatorStyle = UITableViewCellSeparatorStyleNone;
    [_table mas_makeConstraints:^(MASConstraintMaker *make) {
       UIEdgeInsets inset =  UIEdgeInsetsMake(200, 0, 0, 0);
        make.edges.equalTo(self.view).insets(inset);
        if (@available(iOS 11.0, *)) {
            make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-49);
            make.left.equalTo(self.view.mas_safeAreaLayoutGuideLeft);
            make.right.equalTo(self.view.mas_safeAreaLayoutGuideRight);
        }
    }];
    
    _table.delegate = self;
    _table.dataSource = self;

}

#pragma mark --
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *indentier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentier];
    }
    cell.textLabel.text = [NSString stringWithFormat:@"第%ld行",indexPath.row];
    return cell;

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
